package com.yuxin.wx.service;

import com.yuxin.wx.dao.UserDao;
import com.yuxin.wx.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class UserService {
	@Autowired
	private UserDao userDao;

	public User getById(int id){
		return userDao.getById(id);
	}

	@Transactional
	public void dbTx() {
		User u1 = new User();
		u1.setId(10);
		u1.setName("李四");
		userDao.insert(u1);

		User u2 = new User();
		u2.setId(11);
		u2.setName("王五");
		userDao.insert(u2);
	}
}
